package com.twu.biblioteca;

import com.javafx.tools.doclets.formats.html.SourceToHTMLConverter;

import java.io.*;

public class BibliotecaApp {

    private final PrintStream printStream;
    private Library library;
    private BufferedReader in;
    private MenuObject menu;

    public BibliotecaApp(PrintStream printStream, Library library, BufferedReader in, MenuObject menu) {
        this.printStream = printStream;
        this.library = library;
        this.in = in;
        this.menu = menu;
    }

    public void start() throws IOException {
        printWelcome();
        library.printBooks();
        printMenu();

        String menuChoice = in.readLine();
        while (!menu.validateChoice(menuChoice)) {
            printStream.println("Select a valid option!");
            menuChoice = in.readLine();
        }
        menu.implementChoice(menuChoice);


    }

    public void printMenu() {
        printStream.println("Please select an option: ");
        printStream.println("List books");
    }

    private void printWelcome() {
        printStream.println("Welcome to Biblioteca!\n");

    }

}
